#include <iostream>
#include <list>
#include <string>
class Print_name
{
public:
    explicit Print_name(std::ostream& out):out_(out){}
    void operator()(const std::string& name){
        out_ << name << std::endl;
    }
private:
    std::ostream& out_;
};
    
    
int main()
{
    std::string names[] = {" Zhu Bicen",
                     " Wu Jia",
                     " Yuan Qiao",
                     " Ou Yangqian"
    };

    std::list<std::string> name_list(names, names + 4);
    for_each(name_list.begin(), name_list.end(), Print_name(std::cout));
    std::cout << "After sorting...." << std::endl;
    name_list.sort();
    for_each(name_list.begin(), name_list.end(), Print_name(std::cout));    
}

    
